package hawk.example.bookstore.repository;

import glz.hawkframework.sql.condition.Condition;
import glz.hawkframework.sql.util.QueryWrapper;

import hawk.example.bookstore.po.BookAuthorMapPo;
import hawk.example.bookstore.update.BookAuthorMapColumnUpdate;
import hawk.example.bookstore.update.BookAuthorMapUpdate;

import java.math.BigInteger;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.Nullable;

public interface BookAuthorMapRepository {
    void insert(BookAuthorMapPo bookAuthorMapPo);

    void insertSelective(BookAuthorMapPo bookAuthorMapPo);

    void insertMultiple(List<BookAuthorMapPo> bookAuthorMapPos, int chunkSize);

    void insertMultiple(List<BookAuthorMapPo> bookAuthorMapPos);

    void deleteByPrimaryKey(BigInteger bookAuthorMapId, Long recordVersion);

    void updateByPrimaryKey(BookAuthorMapUpdate bookAuthorMapUpdate, BigInteger bookAuthorMapId, Long recordVersion);

    Optional<BookAuthorMapPo> getByPrimaryKey(BigInteger bookAuthorMapId);

    /**
     * Throws an exception if found no required record by the primary key.
     */
    BookAuthorMapPo loadByPrimaryKey(BigInteger bookAuthorMapId);

    /**
     * Throws the supplied exception if found no required record by the primary key.
     */
    <E extends Throwable> BookAuthorMapPo loadByPrimaryKey(BigInteger bookAuthorMapId, Supplier<? extends E> exceptionSupplier) throws E;

    boolean existByPrimaryKey(BigInteger bookAuthorMapId);

    /**
     * Throws an exception if the required record doesn't exist
     */
    void assertExistByPrimaryKey(BigInteger bookAuthorMapId);

    /**
     * Throws the supplied exception if the required record doesn't exist
     */
    <E extends Throwable> void assertExistByPrimaryKey(BigInteger bookAuthorMapId, Supplier<? extends E> exceptionSupplier) throws E;

    Optional<BookAuthorMapPo> queryOne(QueryWrapper queryWrapper);

    List<BookAuthorMapPo> queryMany(QueryWrapper queryWrapper);

    /**
     * Throws an exception if found no required record.
     */
    BookAuthorMapPo loadOne(QueryWrapper queryWrapper);

    /**
     * Throws the supplied exception if found no required record.
     */
    <E extends Throwable> BookAuthorMapPo loadOne(QueryWrapper queryWrapper, Supplier<? extends E> exceptionSupplier) throws E;

    long count(QueryWrapper queryWrapper);

    boolean exist(QueryWrapper queryWrapper);

    /**
     * Throws an exception if found no required record.
     */
    void assertExist(QueryWrapper queryWrapper);

    /**
     * Throws the supplied exception if found no required record.
     */
    <E extends Throwable> void assertExist(QueryWrapper queryWrapper, Supplier<? extends E> exceptionSupplier) throws E;

    boolean existOne(QueryWrapper queryWrapper);

    /**
     * Throws an exception if found no required record or found more than one record.
     */
    void assertExistOne(QueryWrapper queryWrapper);

    /**
     * Throws the supplied exception if found no required record or found more than one record.
     */
    <E extends Throwable> void assertExistOne(QueryWrapper queryWrapper, Supplier<? extends E> exceptionSupplier) throws E;

    long delete(@Nullable Condition condition);

    long update(BookAuthorMapColumnUpdate bookAuthorMapColumnUpdate, @Nullable Condition condition);
}
